/*
 * bitmap.h
 *
 *  Created on: 2013/07/04
 *      Author: fit
 */

#ifndef BITMAP_H_
#define BITMAP_H_

#include <cstdlib>

typedef uint color_t;

typedef struct _point_t
{
	int x;
	int y;
#ifdef __cplusplus
	_point_t operator+(const _point_t& p)
	{
		_point_t result = { x + p.x, y + p.y };
		return result;
	}

	bool operator<(const _point_t& p)
	{
		return y < p.y ? true : (y > p.y ? false : x < p.x);
	}
#endif
} point_t;

class bitmap
{
public:
	color_t* m_bitmap;
	size_t m_width;
	size_t m_height;

	color_t* m_difmap;
	color_t* m_difmap_clean;
	color_t* m_element;
public:
	static const uint COLOR_BYTES = sizeof(color_t);;

public:
	bitmap();
	bitmap(size_t width, size_t height);
	bitmap(size_t width, size_t height, u_char* data, uint comp = 4);
	bitmap(const bitmap& _bitmap);
	virtual ~bitmap();

	void operator=(const bitmap& _bitmap);
	color_t* operator[](size_t y_index);
	bitmap operator*(float scale);

	const color_t* create_difmap();

	const color_t* create_difmapclean();

	int analyze();

	int analyze(uint x, uint y);

	// TODO:
	void getVectorImage();
};

#endif /* BITMAP_H_ */
